<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<style>
  .prevBtn,.nextBtn,.startPage,.endPage,.ge{
    float:left;
  }

</style>
<body>
  <table cellspadding="0" cellspacing="0" width="400px" height="300px" border="1">
    <thead>
      <tr>
        <th>姓名</th>
        <th>年龄</th>
        <th>性别</th>
        <th>班级</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>张三</td>
        <td>1</td>
        <td>男</td>
        <td></td>
      </tr>
      <tr>
        <td>张三</td>
        <td>1</td>
        <td>男</td>
        <td>2</td>
      </tr>
      <tr>
        <td>赵四</td>
        <td>1</td>
        <td>男</td>
        <td>2</td>
      </tr>
      <tr>
        <td>朱刘</td>
        <td>1</td>
        <td>男</td>
        <td>2</td>
      </tr>
      <tr>
        <td>张三</td>
        <td>1</td>
        <td>男</td>
        <td>2</td>
      </tr>
      <tr>
        <td>王五</td>
        <td>1</td>
        <td>男</td>
        <td>2</td>
      </tr>
      <tr>
        <td>张三</td>
        <td>1</td>
        <td>男</td>
        <td>2</td>
      </tr>
      <tr>
        <td>李四</td>
        <td>1</td>
        <td>男</td>
        <td>2</td>
      </tr>
      <tr>
        <td>张三</td>
        <td>1</td>
        <td>男</td>
        <td>2</td>
      </tr>
      <tr>
        <td>张三</td>
        <td>1</td>
        <td>男</td>
        <td>2</td>
      </tr>
    </tbody>
  </table>
  <div class="changePage">
    <div class="prevBtn">上一页</div>
    <div class="startPage">1</div>
    <div class="ge">/</div>
    <div class="endPage">4</div>
    <div class="nextBtn">下一页</div>
  </div>

  <script src="./js/jquery-1.12.2.min.js"></script>
  <script>
  $(function(){
    var pageSize=3;
    var currentPage=0;
    var totalPage=Math.ceil($('table tbody tr').length/pageSize)
    var $table=$('table')
    $('.endPage').html(totalPage)
    $table.bind('paging',function(){
      $table.find('tbody tr').hide().slice(currentPage*pageSize,(currentPage+1)*pageSize).show()
    })
    $table.trigger('paging');
    $('.nextBtn').click(function(event){
      debugger;
      if(currentPage<totalPage-1){
        currentPage+=1
      }
      $table.trigger('paging')
      $('.startPage').html(currentPage+1)
    })
    $('.prevBtn').click(function(event){
      var prevPage=$('.startPage').html()
      var finalPage=Number(prevPage)-1;
      if(finalPage<=0){
        finalPage=1;
      }
      currentPage=finalPage-1;
      $table.trigger('paging')
      $('.startPage').html(finalPage)
    })
  })
  </script>
</body>
</html>